package com.yaoyou.dao;

import com.yaoyou.model.dataObject.OrderItem;
import com.yaoyou.model.dataObject.OrderItemExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface OrderItemMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table ORDER_ITEM
     *
     * @mbggenerated Fri Aug 26 16:08:31 CST 2016
     */
    @SelectProvider(type=OrderItemSqlProvider.class, method="countByExample")
    int countByExample(OrderItemExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table ORDER_ITEM
     *
     * @mbggenerated Fri Aug 26 16:08:31 CST 2016
     */
    @DeleteProvider(type=OrderItemSqlProvider.class, method="deleteByExample")
    int deleteByExample(OrderItemExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table ORDER_ITEM
     *
     * @mbggenerated Fri Aug 26 16:08:31 CST 2016
     */
    @Delete({
        "delete from ORDER_ITEM",
        "where ORDER_ID = #{orderId,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer orderId);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table ORDER_ITEM
     *
     * @mbggenerated Fri Aug 26 16:08:31 CST 2016
     */
    @Insert({
        "insert into ORDER_ITEM (ORDER_ID, ITEM_ID, ",
        "COUNT, PRICE, POINT, ",
        "ACTIVITY_ID, CREATE_TIME)",
        "values (#{orderId,jdbcType=INTEGER}, #{itemId,jdbcType=INTEGER}, ",
        "#{count,jdbcType=INTEGER}, #{price,jdbcType=DECIMAL}, #{point,jdbcType=INTEGER}, ",
        "#{activityId,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP})"
    })
    int insert(OrderItem record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table ORDER_ITEM
     *
     * @mbggenerated Fri Aug 26 16:08:31 CST 2016
     */
    @InsertProvider(type=OrderItemSqlProvider.class, method="insertSelective")
    int insertSelective(OrderItem record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table ORDER_ITEM
     *
     * @mbggenerated Fri Aug 26 16:08:31 CST 2016
     */
    @SelectProvider(type=OrderItemSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="ORDER_ID", property="orderId", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="ITEM_ID", property="itemId", jdbcType=JdbcType.INTEGER),
        @Result(column="COUNT", property="count", jdbcType=JdbcType.INTEGER),
        @Result(column="PRICE", property="price", jdbcType=JdbcType.DECIMAL),
        @Result(column="POINT", property="point", jdbcType=JdbcType.INTEGER),
        @Result(column="ACTIVITY_ID", property="activityId", jdbcType=JdbcType.INTEGER),
        @Result(column="CREATE_TIME", property="createTime", jdbcType=JdbcType.TIMESTAMP)
    })
    List<OrderItem> selectByExample(OrderItemExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table ORDER_ITEM
     *
     * @mbggenerated Fri Aug 26 16:08:31 CST 2016
     */
    @Select({
        "select",
        "ORDER_ID, ITEM_ID, COUNT, PRICE, POINT, ACTIVITY_ID, CREATE_TIME",
        "from ORDER_ITEM",
        "where ORDER_ID = #{orderId,jdbcType=INTEGER}"
    })
    @Results({
        @Result(column="ORDER_ID", property="orderId", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="ITEM_ID", property="itemId", jdbcType=JdbcType.INTEGER),
        @Result(column="COUNT", property="count", jdbcType=JdbcType.INTEGER),
        @Result(column="PRICE", property="price", jdbcType=JdbcType.DECIMAL),
        @Result(column="POINT", property="point", jdbcType=JdbcType.INTEGER),
        @Result(column="ACTIVITY_ID", property="activityId", jdbcType=JdbcType.INTEGER),
        @Result(column="CREATE_TIME", property="createTime", jdbcType=JdbcType.TIMESTAMP)
    })
    OrderItem selectByPrimaryKey(Integer orderId);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table ORDER_ITEM
     *
     * @mbggenerated Fri Aug 26 16:08:31 CST 2016
     */
    @UpdateProvider(type=OrderItemSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") OrderItem record, @Param("example") OrderItemExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table ORDER_ITEM
     *
     * @mbggenerated Fri Aug 26 16:08:31 CST 2016
     */
    @UpdateProvider(type=OrderItemSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") OrderItem record, @Param("example") OrderItemExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table ORDER_ITEM
     *
     * @mbggenerated Fri Aug 26 16:08:31 CST 2016
     */
    @UpdateProvider(type=OrderItemSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(OrderItem record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table ORDER_ITEM
     *
     * @mbggenerated Fri Aug 26 16:08:31 CST 2016
     */
    @Update({
        "update ORDER_ITEM",
        "set ITEM_ID = #{itemId,jdbcType=INTEGER},",
          "COUNT = #{count,jdbcType=INTEGER},",
          "PRICE = #{price,jdbcType=DECIMAL},",
          "POINT = #{point,jdbcType=INTEGER},",
          "ACTIVITY_ID = #{activityId,jdbcType=INTEGER},",
          "CREATE_TIME = #{createTime,jdbcType=TIMESTAMP}",
        "where ORDER_ID = #{orderId,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(OrderItem record);
}